import fetch from 'utils/fetch';

export function loginByEmail(username, password, formControl) {
	const data = {
		username,
		password,
		formControl
	};
	return fetch({
		url: '/api/auth/token',
		method: 'post',
		data
	});
}

export function formcontrol() {
	return fetch({
		url: '/api/captcha/getCaptchaCode',
		method: 'post'
	});
}

export function logout(token) {
	return fetch({
		url: '/api/auth/jwt/invalid',
		method: 'post',
		params: {
			token
		}
	});
}

export function getInfo(token) {
	return fetch({
		url: '/api/user/front/info',
		method: 'get',
		params: {
			token
		}
	});
}

export function getMenus(token) {
	return fetch({
		url: '/api/user/front/menus',
		method: 'get',
		params: {
			token
		}
	});
}

export function getAllMenus() {
	return fetch({
		url: '/api/user/front/menu/all',
		method: 'get'
	});
}